package de.fhkiel.webservice.data;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.CascadeType;
import javax.persistence.FetchType;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;

@Entity
@Table(name="payment")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "payment", propOrder = { "id", "name", "address", "bankInfo", "paymentRow" })
public class Payment implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue
	@Column(name="payment_id")
	private Long id;
	
	@Column(name="name")
	private String name;
	
	@Column(name="address")
	private String address;
	
	@Column(name="bankinfo")
	private String bankInfo;
	
	@OneToMany(cascade=CascadeType.ALL, mappedBy="payment", fetch=FetchType.LAZY)
    private Set<PaymentRow> paymentRow;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}
	
	public String getBankInfo() {
		return bankInfo;
	}

	public void setBankInfo(String bankInfo) {
		this.bankInfo = bankInfo;
	}
	
	public Set<PaymentRow> getPaymentrow() {
		return paymentRow;
	}

	public void setPaymentrow(Set<PaymentRow> paymentRow) {
		this.paymentRow = paymentRow;
	}
	
	@Override
	public String toString() {
		return " ID ["+id+"]"+
				" name ["+name+"]"+
				" address ["+address+"]"+
				" bankinfo ["+bankInfo+"]";
	}
}
